﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EmbeddedLanguage.Attributes
{
    [AttributeUsage(
        validOn: AttributeTargets.Class,
        AllowMultiple = true,
        Inherited = true
    )]
    public class ExpressionCompilerAttribute : Attribute
    {
        private Type _CompilerType;
        public Type CompilerType
        {
            get { return this._CompilerType; }
            set {
                if (!value.IsAssignableFrom(typeof(IStaticExpressionCompiler)))
                {
                    throw new InvalidCastException("ExpressionCompiler.CompilerType must implement IStaticExpressionCompiler");
                }
                this._CompilerType = value; 
            }
        }
    }
}
